package com.penfei.springrun.result

import com.penfei.springrun.model.EmptyModel

class ResponseResult(var code: Int, var msg: String, var data: Any) {

    constructor(codeMsg: CodeMsg, data: Any) : this(codeMsg.code, codeMsg.msg, data)

    companion object {
        fun success(data: Any) = ResponseResult(CodeMsg.SUCCESS, data)
        fun fail() = ResponseResult(CodeMsg.FAIL, EmptyModel())
        fun fail(codeMsg: CodeMsg) = ResponseResult(codeMsg, EmptyModel())
    }
}